//导入vue和vue-router
import Vue from "vue";
import VueRouter from "vue-router";

//登录组件
import Login from '@/components/pages/login/Login';
// 管理端组件
// import PermissionList from '@/components/pages/permission-list/PermissionList';
import Home from '@/components/pages/home/Home';
import UserList from '@/components/pages/user-list/UserList';
import NoticeList from '@/components/pages/notice-list/NoticeList'
import BlogList from '@/components/pages/blog-list/BlogList'
import ScoreManage from '@/components/pages/score-manage/ScoreManage'
import ScoreList from '@/components/pages/score-list/ScoreList'
import MatchList from '@/components/pages/match-list/MatchList'
import AdvertList from '@/components/pages/advert-list/AdvertList'
import DictList from '@/components/pages/dict-list/DictList'
import TestList from '@/components/pages/test-list/TestList'
import ResetPassword from '@/components/pages/reset-password/ResetPassword'


//将router安装到vue中
Vue.use(VueRouter);

//创建路由实例
const router = new VueRouter({
    routes:[
        {path:'/',redirect:'/login'},
        {path:'/login',component:Login},//用户的登录
        // {path:'/permission/list',component:PermissionList},
        {path:'/home',component:Home},
        {path:'/system/notice',component:NoticeList},
        {path:'/user/list',component:UserList},
        {path:'/blog/list',component:BlogList},
        {path:'/score/manage/rules',component:ScoreManage},
        {path:'/score/manage/user/list',component:ScoreList},
        {path:'/match/list',component:MatchList},
        {path:'/advert/list',component:AdvertList},
        {path:'/dict/list',component:DictList},
        {path:'/test/list',component:TestList},
        {path:'/reset/password',component:ResetPassword}
    ]
});



//解决路径相同报错的问题
const routerPush = VueRouter.prototype.push;
VueRouter.prototype.push=function push(to){
    return routerPush.call(this, to).catch(err => err)
}


//4.向外共享路由实例
export default router;
